home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
qblib10.arc
/
QUICKBAS.DOC
< prev
next >
Wrap
Text File
|
1987-09-22
|
43KB
|
1,981 lines
QUICKBAS.LIB -- Version 1.0
September 22, 1987
Harold Thomson
7437 Burnway Drive
Orlando, Fl. 32819
TABLE OF CONTENTS
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . 2
Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . 3
QINIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
QINPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
QMENU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
LOWER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
QEXTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
QWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
QWORDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
UPPER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
QATTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
QPRTN QPRTA QPRTH QPRTE . . . . . . . . . . . . . . . . . . 10
QMPRTN QMPRTA QMPRTH QMPRTE . . . . . . . . . . . . . . . . 11
QSCROLL . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
QSCROLLB . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
QSCRREST . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
QSCRSAVE . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
QWINDOW . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
QWINDOWH . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
QWINDOWV . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
VIDREST . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
VIDSAVE . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
QGETDRV . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
QSETDRV . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Sub-Directory . . . . . . . . . . . . . . . . . . . . . . . . . 19
QCHDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
QCHKDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
QGETDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
QMKDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
QRMDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
QCOPYFIL . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
QDELETE . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
QEXIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
QMOVEFIL . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
QRENAME . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
QUICKBAS.LIB -- Version 1.0 ii
Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . 26
ALARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
QCLOCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
QDOSVER . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
PAUSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
QWEEKDAY . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
QUICKBAS.LIB -- Version 1.0 iii
INTRODUCTION
Quickbas.Lib is a collection of subroutines written in Assembler for
the Microsoft Quick Basic compiler. Many of the routines are
functionally the same as routines found in other Basic Library
packages. In addition, I have added several routines that were not
available and which I find to be very helpful. I have tested all of
the routines and they have worked for me on my AT&T PC6300. I am sure
that they will work on any AT&T compatable machine. While I cannot
afford to purchase the Microsoft BASIC compiler, I believe that these
routines will function as written on that compiler.
The reason that I wrote these routines is because I found that my
favorite subroutine library has finally gone commercial. While I can
understand the reason for doing this, I do not completely agree with
it. The routines that I have written are for whomever wants to use
them. I am not charging anything as long as they are used for personal
use or freeware programs. If any of these routines are to be used in
any packages that are to be sold to the public, I feel it is only fair
that I be informed of this use. I also feel that it would be
appropriate in this case to send me a small donation. I am not in
this to make money but if someone else is going to make money from my
work, I should get at least a little something from it.
As you may have noticed, I did not include the source code for these
routines. The reason for this is to protect these routines from any
changes which may cause them to no longer function the way they are
documented. I am willing to accept any comments or suggestions for
changes but I will have the final say on what happens. I do not
intend to make changes which would cause these routine not to function
as originally documented unless it is felt that these changes will
only improve the routines. Of course if this happens, I will make note
of it so please read the #@!%$& documentation. (I know, I hate to
read documentation almost as much as I hate writing it.)
I do have one thing that I would like to ask of anyone who might
decide to use any or all of these routines, let me know what you think
of them. I like praise but I can also take criticisum. You can
either sent me a note at the address on the front cover of leave a
note for me on the DeathStar RBBS in Orlando. The number is
305-660-6300.
Make sure that you read the information on Global Variables, it is
very important if you want the routines to function properly.
QUICKBAS.LIB -- Version 1.0 1
ACKNOWLEDGEMENTS
As in past endevors, Charlie Wooster has been very helpful in helping
me develop these routines. He has the foresight to think of routines
that users could use instead of creating routines and then hoping that
people will use them. Thanks Charlie!
I would like to take credit for all the routines contained in Quickbas
but that is not the case. Many of the routines were derived from
routines in Leo J. Scanlons "Assembly Language Subroutines for MS-DOS
Computers". This is a very handy book and if you don't have a copy
and like to write assembly programs, I would recommend it. Another of
his books that I use quite often is "8086/88 Assembly Language
Programming". Page 100 is used quite often.
The QINPUT routine included in the library was developed from the
article "The Finishing Strokes" by Hardin Brothers in the September
1987 (#6) issue of PCResource magazine. Hardin has been writing good
articles for some time now, I remember some from 80 MICRO, and he has
several good ones in PCResource. I find this a very good magazine
with a good amount of information on Quick Basic programming.
The QCLOCK routine supplied is based upon the CLOCK.ASM program by
Robert J. Karp in the October 13, 1987 issue (Vol 7, Number 17) of PC
Magazine.
QUICKBAS.LIB -- Version 1.0 2
GLOBAL VARIABLES
QINIT
In order to make these routines a little easier to use, I have
provided the following routine which will set some global variables
which are shared by most of the other routines as well as the BASIC
program. This means that you will not have to include certain
variables when they are called. This will make the calling sequence
somewhat smaller and easier to remember. In addition, there are also
some internal variables that get set which are only used by routines I
have provided. I have included the call in all of the examples where
the routine is required.
The parameters that are used by QINIT are as follow:
NAttr - The normal print color attribute.
AAttr - The action color attribute.
HAttr - The attribute that is used for high-lighting.
EAttr - The error attribute.
RC - The return code variable set in various routines.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
Fgrd = 7 : Bkgrd = 0
CALL QATTR(Fgrd,Bkgrd,Nattr)
QUICKBAS.LIB -- Version 1.0 3
KEYBOARD
QINPUT
A keyboard input routine that has full editing capabilities. By
passing a verification string, each key stroke is validated as it is
entered. It also returns a RETURN CODE which indicates which key was
pressed to exit the input routine. The input string can either be all
spaces or it can contain existing data to be updated. It should be
noted here, because of the restrictions BASIC forces on called
subroutines in ASSEMBLER, the size of the string must be set before
calling the subroutine. The RC variable must be initialized with a
number from 0 to 50 which is used to set which return keys will be
used. The keys with an RC equal to or less than the passed number will
be the active return keys. See the next page for the valid return
keys. The color attribute used by the program is the Aattr variable.
The program will reverse the color attribute that is set, which
usually means that the input field will highlighted.
The format of the call is as follows:
CALL QINPUT(Ver$,InBuff$,Row,Col,Page,Slen)
Where:
Ver$ - the string containing that valid characters.
InBuff$ - the input buffer which can be pre-populated.
Row - the screen row to display the buffer.
Column - the screen column to display the buffer.
Page - the video display page (Valid pages are 0-3).
Slen - the length of InBuff$ less the trailing spaces on
return.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
Fgrd = 7
Bkgrd = 1
CALL QATTR(Fgrd,Bkgrd,Aattr)
REM Only accept alpha-numeric input
Ver$ = "0123456789"
Ver$ = Ver$+"abcdefghijklmnopqrstuvwxyz"
Ver$ = Ver$+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
InBuff$ = SPACE$(20)
Row = 10 : Col = 20 : Page = 0 : RC = 8
CALL QINPUT(Ver$,InBuff$,Row,Col,Page,Slen)
IF RC > 0 THEN
InBuff$ = LEFT$(InBuff$,Slen)
END IF
QUICKBAS.LIB -- Version 1.0 4
The following are the valid editing keys:
INSERT - Toggles the insert mode and over-type mode.
DELETE - Delete character at cursor.
BACKSPACE - Destructive backspace.
LEFT ARROW - Move the cursor to the left.
RIGHT ARROW - Move the cursor to the right.
HOME - Move the cursor to the beginning of the field.
END - Move the cursor to the end of the field.
CTL-HOME - Move cursor to the start and erase the field.
CTL-END - Erase from the cursor to the end of the field.
CTL-BkSpace - Erase from the cursor to the start of the field.
The following are the return codes returned upon exit:
RC - Key pressed RC - Key pressed
00 - ESC 09 - ALT HOME
01 - RETURN 10 - ALT-END
02 - CTL-RETURN 11-20 - F1 thru F10
03 - TAB 21-30 - SHIFT-F1 thru SHIFT-F10
04 - SHIFT-TAB 31-40 - CTL-F1 thru CTL-F10
05 - UP ARROW 41-50 - ALT-F1 thru ALT-F10
06 - DOWN ARROW
07 - PAGE UP
08 - PAGE DOWN
QUICKBAS.LIB -- Version 1.0 5
QMENU
A menu routine that display a menu string array. Upon exit it will
pass back in the RC which menu item was pressed or if the escape key
was pressed (0). This routine uses the QINIT routine. It also uses
the Nattr, Aattr and the Hattr color attributes to display the menu.
The menu selection number will be returned in the RC variable.
The format of the call is as follows:
CALL QMENU(ArrayCnt,FirstAddr,Row,Col,Page)
Where:
ArrayCnt - the number of array elements.
FirstAddr - the VARPTR address of the first array element.
Row - the screen row to start printing the menu.
Column - the screen column to use.
Page - the video display page (Valid pages are 0-3).
Example:
OPTION BASE 0
DEFINT A-Z
DIM XX$(5)
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
CALL QATTR(1,3,nattr)
CALL QATTR(5,3,aattr)
CALL QATTR(3,1,hattr)
.
XX$(0)= "A - This is row one "
XX$(1)= "B - This is row two "
XX$(2)= "C - This is row three "
XX$(3)= "D - This is row four "
XX$(4)= "E - This is row five "
.
ArrayCnt = UBOUND(XX$,1)
FirstAddr = VARPTR(XX$(0))
Row = (24-UBOUND(XX$,1))\2
X = LEN(XX$(0))
Col = (80-X)\2
Page = 0
CALL QMENU(ArrayCnt,FirstAddr,Row,Col,Page)
.
ON RC GOTO Label 1,Label 2,Label 3,Label 4,Label 5
END
.
.
QUICKBAS.LIB -- Version 1.0 6
The following are the valid menu keys:
ESCAPE - Exit the menu routine.
RETURN - Select current highlighted item.
UP ARROW - Move the Menu bar up.
DOWN ARROW - Move the Menu bar down.
HOME - Move the Menu bar to the first item.
END - Move the Menu bar to the last item.
QUICKBAS.LIB -- Version 1.0 7
STRING
LOWER
Converts a string to all lowercase characters.
Example:
TstStr$="THIS STrING Will be conVERted to LOWERcase"
CALL LOWER(TstStr$)
QEXTRACT
Returns the start and length of a word in a string based upon a
delimiter which is passed in the call.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
TstStr$="This@string@contains@five@words"
Index = 4
Delim = "@"
CALL QEXTRACT(TstStr$,DELIM,Index,Strt,Slen)
Found$ = MID$(TstStr$,Strt,Slen)
PRINT "The fourth word of the string is " Found$
QWORD
Returns the start and length of a word in a space delimited string.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
TstStr$="This string contains five words"
Index = 4
CALL QWORD(TstStr$,Index,Strt,Slen)
Found$ = MID$(TstStr$,Strt,Slen)
PRINT "The fourth word of the string is " Found$
QUICKBAS.LIB -- Version 1.0 8
QWORDS
Returns the number of space delimited words in a string.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
TstStr$="This string contains five words"
CALL QWORDS(TstStr$)
PRINT "The number of words in this string is " RC
UPPER
Converts a string to all uppercase characters.
Example:
TstStr$="THIS STrING Will be conVERted to UPPERcase"
CALL UPPER(TstStr$)
QUICKBAS.LIB -- Version 1.0 9
VIDEO
QATTR
Calculates the color attribute for routines such as QPRT, QWINDOW, etc
It also allows use of the "blink" attribute.
Example:
DEFINT A-Z
Fgrd = 7 : Bkgrd = 0
CALL QATTR(Fgrd,Bkgrd,Nattr)
QPRTN QPRTA QPRTH QPRTE
Print a string at the specified location on the screen. The last
character of the name determines which of the four global attributes
will be used. It also allows the string to be print on any of the 4
video pages.
The parameters that are used by QPRTx are as follow:
Prt$ - The string to be printed.
Row - The row to print.
Col - The column to print.
Page - The video page to print on.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
.
Prt$="This is the string to be printed."
Fgrd = 7 : Bkgrd = 0
CALL QATTR(Fgrd,Bkgrd,NAttr)
Row=5 : Col=10 : Page=0
CALL QPRTN(Prt$,Row,Col,Page)
QUICKBAS.LIB -- Version 1.0 10
QMPRTN QMPRTA QMPRTH QMPRTE
Print a string array at the specified location on the screen. The
last character of the name determines which of the four global
attributes will be used. It also allows the string to be print on any
of the 4 video pages.
The parameters that are used by QMPRTx are as follow:
Elements - The number of occurances of the array.
FrstAddr - The VARPTR addres of the first array element.
Row - The row to start printing.
Col - The column to start in.
Page - The video page to print on.
Example:
OPTION BASE 0
DEFINT A-Z
DIM Prt$(4)
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
.
Prt$(0)="This is the first string to be printed."
Prt$(1)="This is the second string to be printed."
Prt$(2)="This is the third string to be printed."
Prt$(3)="This is the fourth string to be printed."
Fgrd = 1 : Bkgrd = 7
CALL QATTR(Fgrd,Bkgrd,AAttr)
Row=5 : Col=10 : Page=0
Elements=4 : FrstAddr=VARPTR(PRT$(0))
CALL QMPRTA(Elements,FrstAddr,Row,Col,Page)
QUICKBAS.LIB -- Version 1.0 11
QSCROLL
Scrolls the screen up using the locations that are passed in the call.
One or more lines can be scrolled and if the number is zero, the whole
area will be cleared. Be sure that the rows and columns are within
the screen.
Example:
DEFINT A-Z
Trow = 5 : Lcol = 15 : Brow = 15 : Rcol = 65 : Lines = 2
CALL QSCROLL(Trow,Lcol,Brow,Rcol,Lines)
.
REM The following will clear an area of the screen
Trow = 5 : Lcol = 15 : Brow = 15 : Rcol = 65 : Lines = 0
CALL QSCROLL(Trow,Lcol,Brow,Rcol,Lines)
QSCROLLB
Scrolls the screen down using the locations that are passed in the
call. One or more lines can be scrolled and if the number is
zero, the whole area will be cleared. Be sure that the rows and
columns are within the screen.
Example:
DEFINT A-Z
Trow = 5 : Lcol = 15 : Brow = 15 : Rcol = 65 : Lines = 2
CALL QSCROLLB(Trow,Lcol,Brow,Rcol,Lines)
QUICKBAS.LIB -- Version 1.0 12
QSCRREST
Restore the screen from an array that had been saved with
QSCRSAVE. It will restore the screen to any of the 4 video pages.
Example:
OPTION BASE 1
DEFINT A-Z
DIM ScrnHold(2000)
ArrayAddr = VARPTR(ScrnHold(1)) : Page = 0
CALL QSCRREST(ArrayAddr,Page)
LOCATE RowHold,ColHold
QSCRSAVE
Save the requested video page (0 - 3) into array. Use this in
text mode only. The array must be an integer array dimensioned to
at least 2000 occurances. The starting address of the array must
be passed, use the VARPTR function to get this address. The
cursor location is not saved so, if it is needed, save the
location. More than one screen can be saved into the array as
long as 2000 occurances are dimensioned for each screen and the
appropriate VARPTR address is passed the the routine.
Example:
OPTION BASE 1
DEFINT A-Z
DIM ScrnHold(2000)
ArrayAddr = VARPTR(ScrnHold(1)) : Page = 0
CALL QSCRSAVE(ArrayAddr,Page)
RowHold = CSRLIN : ColHold = POS(0)
QUICKBAS.LIB -- Version 1.0 13
QWINDOW
Displays a pop-up window on the screen. It requires several
parameters which are used to determine where to print the window
as well as the type of frame to be used for the window. The rows
and columns that are used and the ones that will be used for the
frame. This routine uses the NAttr color attribute that must be
initialized with QINIT prior to using QWINDOW. If the value
passed is not 1-4, the screen will be cleared based upon the row
and column values.
The parameters that are used by QWINDOW are as follow:
TRow - The top row of the window.
LCol - The left column of the window.
BRow - The bottom row of the window.
RCol - The right column of the window.
Frame - The type of frame to be used for the window.
Page - The video page to print the window on.
The types of frames available with QWINDOW are as follow:
1 - Single line frame.
2 - Double line frame.
3 - Double vertical and single horizontial frame.
4 - Single vertical and double horizontial frame.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
.
Fgrd=7 : Bkgrd=0
CALL QATTR(Fgrd,Bkgrd,NAttr)
TRow=1 : LCol=1 : BRow=25 : RCol=80 : Frame=2 : Page=0
CALL QWINDOW(TRow,LCol,BRow,RCol,Frame,Page)
QUICKBAS.LIB -- Version 1.0 14
QWINDOWH
Works just like QWINDOW, but in addition, it will draw horizontial
lines across the window bases upon the values passed in NLines and
RNum. This routine can be very useful in menu windows. If the
value passed in NLines is zero, it will function the same as
QWINDOW. The VARPTR function must be used to get the address of
the first array element.
To use this routine, you must define a numeric array. Each element
of this array will contain the row in which you wish to have a
line drawn across the window. The address of the first occurance
of the array is what is passed to the routine.
The parameters that are used by QWINDOWH are as follow:
TRow - The top row of the window.
LCol - The left column of the window.
BRow - The bottom row of the window.
RCol - The right column of the window.
NLine - The number of horizontial lines to draw.
RNum - The VARPTR address of the first array element.
Frame - The type of frame to be used for the window.
Page - The video page to print the window on.
The types of frames available with QWINDOWH are as follow:
1 - Single line frame.
2 - Double line frame.
3 - Double vertical and single horizontial frame.
4 - Single vertical and double horizontial frame.
Example:
OPTION BASE 0
DEFINT A-Z
DIM ARow(2)
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
.
Fgrd=7 : Bkgrd=0
CALL QATTR(Fgrd,Bkgrd,NAttr)
TRow=1 : LCol=1 : BRow=25 : RCol=80 : Frame=2 : Page=0
NLine=2 : ARow(0)=3 : ARow(1)=23 : RNum=VARPTR(ARow(0))
CALL QWINDOWH(TRow,LCol,BRow,RCol,NLine,RNum,Frame,Page)
QUICKBAS.LIB -- Version 1.0 15
QWINDOWV
Works just like QWINDOW, but in addition, it will draw vertical
lines down the window bases upon the values passed in NLines and
CNum. If the value passed in NLines is zero, it will function the
same as QWINDOW. The VARPTR function must be used to get the
address of the first array element.
To use this routine, you must define a numeric array. Each element
of this array will contain the row in which you wish to have a
line drawn down the window. The address of the first occurance of
the array is what is passed to the routine.
The parameters that are used by QWINDOWV are as follow:
TRow - The top row of the window.
LCol - The left column of the window.
BRow - The bottom row of the window.
RCol - The right column of the window.
NLine - The number of vertiacl lines to draw.
CNum - The VARPTR address of the first array element.
Frame - The type of frame to be used for the window.
Page - The video page to print the window on.
The types of frames available with QWINDOWV are as follow:
1 - Single line frame.
2 - Double line frame.
3 - Double vertical and single horizontial frame.
4 - Single vertical and double horizontial frame.
Example:
OPTION BASE 0
DEFINT A-Z
DIM ACol(2)
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
.
Fgrd=7 : Bkgrd=0
CALL QATTR(Fgrd,Bkgrd,NAttr)
TRow=1 : LCol=1 : BRow=25 : RCol=80 : Frame=2 : Page=0
NLine=2 : ACol(0)=5 : ACol(1)=75 : CNum=VARPTR(ACol(0))
CALL QWINDOWV(TRow,LCol,BRow,RCol,NLine,CNum,Frame,Page)
QUICKBAS.LIB -- Version 1.0 16
VIDREST
Restore a screen that was saved with VIDSAVE. Color and
monochrome screens have 4 pages of video memory and this routine
will move a screen from pages 1-3 to page 0.
Example:
DEFINT A-Z
Page = 2
CALL VIDREST(Page)
VIDSAVE
Save a screen to video page 1, 2 or 3 from page 0.
Example:
DEFINT A-Z
Page = 2
CALL VIDSAVE(Page)
QUICKBAS.LIB -- Version 1.0 17
DISK
QGETDRV
Get the current logged disk drive.
Example:
DrvStr$="?:\"
CALL QGETDRV(DrvStr$)
PRINT "The current disk is " DrvStr$
QSETDRV
Change the current logged disk drive.
Example:
NewDrv$="C:"
CALL QSETDRV(NewDrv$)
QUICKBAS.LIB -- Version 1.0 18
SUB-DIRECTORY
QCHDIR
Change the current sub-directory. Works the same as the DOS CHDIR
command except a return code is set.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
ChFile$="C:\NEWSUB\DIR"+CHR$(0)
CALL QCHDIR(ChFile$)
IF RC THEN
PRINT "New directory not selected"
ELSE
PRINT "New directory"
END IF
QCHKDIR
Checks to see if the requested sub-directory exists. The return code
is set if the directory doesn't exist.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
ChkFile$="C:\CHKSUB\DIR"+CHR$(0)
CALL QCHKDIR(ChkFile$)
IF RC THEN
PRINT "The requested sub-directory doesn't exist"
ELSE
PRINT "Sub-directory exists"
END IF
QUICKBAS.LIB -- Version 1.0 19
QGETDIR
Get the current sub-directory. The size of the directory name is
returned.
Example:
DEFINT A-Z
DirStr$=SPACE$(64)
CALL QGETDIR(DirStr$,Dlen)
DirStr$ = LEFT$(DirStr$,Dlen)
PRINT "The current directory is " DirStr$
QMKDIR
Create a new sub-directory. Works the same as the DOS MKDIR command
except a return code is set if the directory wasn't created.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
MkFile$="NEWSUBDIR"+CHR$(0)
CALL QMKDIR(MkFile$)
IF RC THEN
PRINT "New directory not created"
ELSE
PRINT "New directory created"
END IF
QUICKBAS.LIB -- Version 1.0 20
QRMDIR
Deletes an existing sub-directory. Works the same a the DOS RMDIR
command except the return code will be set if the requested directory
doesn't already exist.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
RmFile$="OLDSUBDIR"+CHR$(0)
CALL QRMDIR(RmFile$)
IF RC THEN
PRINT "The sub-directory was not deleted"
ELSE
PRINT "The sub-directory was deleted"
END IF
QUICKBAS.LIB -- Version 1.0 21
FILE
QCOPYFIL
Copies a file. This is a better way of copying a file because it does
not require the SHELL command. This routine will replace the file on
the destination device, use QEXIST to check if the file already
exists. The return code will be set if any errors are encountered.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
OldFile$="TESTFILE.OLD"+CHR$(0)
NewFile$="TESTFILE.NEW"+CHR$(0)
CALL QCOPYFIL(OldFile$,NewFile$)
IF RC THEN
PRINT "File not copied"
ELSE
PRINT "File copied"
END IF
QDELETE
Deletes a file. Wildcards not allowed. Upon exit, a return code is
set to indicate if the file was deleted or not.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
DelFile$="QUICKBAS.LIB"+CHR$(0)
CALL QDELETE(DelFile$)
IF RC THEN
PRINT "File not deleted"
ELSE
PRINT "File deleted"
END IF
QUICKBAS.LIB -- Version 1.0 22
QEXIST
Tells you if the requested file already exists. Returns zero if it
doesn't, or a -1 if it does. Requires an ASCIZ filename without
wildcards.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
ChkFile$="FINDFILE.TXT"+CHR$(0)
CALL QEXIST(ChkFile$)
IF RC THEN
PRINT "File already exists"
ELSE
PRINT "File not found"
END IF
QUICKBAS.LIB -- Version 1.0 23
QMOVEFIL
Moves a file. It functions the same way as QCOPYFIL but the original
file will be deleted after the copy is completed. If the file is to
be moved to a different directory on the same device, it will move
just the directory entry which will make the move much faster. See
QCOPYFIL for additional information.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
REM Move a file from the A drive to the C drive
OldFile$="A:TESTFILE.TXT"+CHR$(0)
NewFile$="C:\TESTSUB\TESTFILE.TXT"+CHR$(0)
CALL QCOPYFIL(OldFile$,NewFile$)
IF RC THEN
PRINT "File not moved"
ELSE
PRINT "File moved"
END IF
.
.
REM Move a file to a different directory on the C drive
OldFile$="TESTFILE.TXT"+CHR$(0)
NewFile$="\TESTSUB\TESTFILE.TXT"+CHR$(0)
CALL QCOPYFIL(OldFile$,NewFile$)
IF RC THEN
PRINT "File not moved"
ELSE
PRINT "File moved"
END IF
QUICKBAS.LIB -- Version 1.0 24
QRENAME
Rename an existing file. Can also be used to move a file from one
sub-directory to another. Requires an ASCIIZ filename without
wildcards for both files.
Example:
DEFINT A-Z
NAttr = 0 : AAttr = 0 : HAttr = 0 : EAttr = 0 : RC = 0
CALL QINIT(NAttr,AAttr,HAttr,EAttr,RC)
.
REM Rename a file
OldFile$="\FIRSTDIR\MYFILE.TXT"+CHR$(0)
NewFile$="MYFILE.DOC"+CHR$(0)
CALL QRENAME(OldFile$,NewFile$)
IF RC THEN
PRINT "File not renamed"
ELSE
PRINT "File renamed"
END IF
.
.
REM Move a file
OldFile$="\FIRSTDIR\MYFILE.TXT"+CHR$(0)
NewFile$="\SECONDDIR\MYFILE.TXT"+CHR$(0)
CALL QRENAME(OldFile$,NewFile$)
IF RC THEN
PRINT "File not moved"
ELSE
PRINT "File moved"
END IF
QUICKBAS.LIB -- Version 1.0 25
MISCELLANEOUS
ALARM
Produces a pulsating alarm tone.
Example:
CALL ALARM
QCLOCK
Display a running clock on the screen. This is a very nice touch on
menu and update screens. The clock can be turned on and off by
flipping the "switch" (1 = on, 0 = off). The routine can also be
called again to move the location of the clock without having to first
turn it off.
Example:
DEFINT A-Z
.
REM Turn the clock on
Fgrd=5 : Bkgrd=7
CALL QATTR(Fgrd,Bkgrd,NAttr)
Row = 2
Col = 70
Switch = 1
Page = 0
CALL QCLOCK(Row,Col,NAttr,Page,Switch)
.
.
.
REM Turn the clock off
Switch = 0
CALL QCLOCK(Row,Col,NAttr,Page,Switch)
QUICKBAS.LIB -- Version 1.0 26
QDOSVER
Retrieve the MS-DOS version. The major version is returned in the
first parm and the minor version in the second parm.
Example:
DEFINT A-Z
CALL QDOSVER(Lparm,Rparm)
PAUSE
Pause for a given number of seconds. It uses the system clock and
will pause for the same amount of time regardless of the CPU used.
Example:
DEFINT A-Z
Seconds = 15
CALL PAUSE(Seconds)
QWEEKDAY
Returns a number indicating the current day of the week.
Example:
OPTION BASE 1
DEFINT A-Z
Days$ ="Sun Mon Tues Wednes Thurs Fri Satur"
.
CALL QWEEKDAY(Day)
CALL QWORD(Days$,Day,Strt,Slen)
Today$ = MID$(Days$,Strt,Slen)+"day"
PRINT "Today is " Today$
QUICKBAS.LIB -- Version 1.0 27